﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using DAL;
using System.Data;
using System.Data.SqlClient;
namespace BUS
{
    class KhachHang_BUS:SqlDataProvider
    {
        SqlDataProvider db = new SqlDataProvider();
        private static KhachHang_DAO _KhachHangDAO = new KhachHang_DAO();
        public DataTable allKhachHang()
        {
            return db.myTable_sp("sp_sel_all_KhachHang");
        }
        public DataTable MaKhachHang()
        {
            return db.myTable_sp("sp_laymakh");
        }
        public bool Del(int makh)
        {
            SqlParameter p0 = new SqlParameter("@MaKhachHang", makh);
            return db.exe_sp("sp_Del_KhachHang", p0);
        }
        public static bool Customer_Insert_Up(VO.KhachHang_OBJ obj)
        {
            return _KhachHangDAO.Customer_Insert_Up(obj);
        }
        public DataTable Search_KH(string option,string hoten,string diachi,string dienthoai)
        {
            SqlDataProvider db = new SqlDataProvider();
            SqlParameter[] p = new SqlParameter[4];
            p[0] = new SqlParameter("@option", option);
            p[1] = new SqlParameter("@HoTen", hoten);
            p[2] = new SqlParameter("@DiaChi", diachi);
            p[3] = new SqlParameter("@DienThoai", dienthoai);
            return db.myTable_sp("sp_Search_KhachHang", p);
        }
    }
}
